

import java.util.ArrayList;

import javax.swing.JPanel;

public class PizzaAdapterList extends JPanel{
	int width , height;
	ArrayList<Pizza> pizzaList=null;
	ArrayList<PizzaRow> pizzaRows = new ArrayList<PizzaRow>();
	public PizzaAdapterList(int width, int height,ArrayList<Pizza> pizzaList) {
		super();
		setLayout(null);
		setBounds(150, 0, width, height);
		this.setVisible(true);
		this.width = width;
		this.height = height;
		this.pizzaList=pizzaList;
		createRows();
		showFirstThree();
	}
	private void showFirstThree() {
		for (int i = 0; i < 3; i++) {
			pizzaRows.get(i).setVisible(true);
		}
	}
	public void createRows() {
		for (int i = 0; i < pizzaList.size(); i++) {
			pizzaRows.add(new PizzaRow(i*130, width, height/3, pizzaList.get(i)));
		}
		for (PizzaRow pizzaRow : pizzaRows) {
			pizzaRow.setVisible(false);
			this.add(pizzaRow);
		}
	}
	
}
